package com.simen.sample.activitygroup.base;

import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import android.util.Log;

/**
 * @author Created by Simen.
 * @date 2018/6/18 11:19
 * @modify Simen
 */
public class MyApp extends Application {
    
    @Override
    public void onCreate() {
        super.onCreate();
        
        registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
    
            private static final String TAG = "ActivityLifecycle";
            
            @Override
            public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
                Log.i(TAG, "onActivityCreated: "+activity.getClass().getCanonicalName());
            }
    
            @Override
            public void onActivityStarted(Activity activity) {
                Log.i(TAG, "onActivityStarted: "+activity.getClass().getCanonicalName());
            }
    
            @Override
            public void onActivityResumed(Activity activity) {
                Log.d(TAG, "onActivityResumed: "+activity.getClass().getCanonicalName());
            }
    
            @Override
            public void onActivityPaused(Activity activity) {
                Log.i(TAG, "onActivityPaused: "+activity.getClass().getCanonicalName());
            }
    
            @Override
            public void onActivityStopped(Activity activity) {
                Log.i(TAG, "onActivityStopped: "+activity.getClass().getCanonicalName());
            }
    
            @Override
            public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
                Log.i(TAG, "onActivitySaveInstanceState: "+activity.getClass().getCanonicalName());
            }
    
            @Override
            public void onActivityDestroyed(Activity activity) {
                Log.i(TAG, "onActivityDestroyed: "+activity.getClass().getCanonicalName());
            }
        });
    }
    
}
